<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title><s:text name="title" /></title>
	</head>
	<body>
		<s:actionerror />
		<s:fielderror></s:fielderror>
		<p>
			<a href="./main.action"><s:text name="return" /> </a>
			<a href="../login/logOut.action"><s:text name="logOut" /> </a>
		</p>
		<s:if test="#session.user.type==2">
			<p><s:text name="airportList" />
				<a href="./airportInfo.jsp"><s:text name="insert" /> </a>
				<input type="button" value="<s:text name='delete'/>"
					onclick="document.getElementById('deleteAirportsForm').submit();">
			</p>
			<s:if test="airportList.size()>0">
			<table cellspacing="1" cellpadding="1" border="1">
				<thead>
					<tr>
						<th>
							<input type="checkbox" name="all" id="all"
								onclick="selectAll('all','id');">
						</th>
						<th align="center">
							<s:text name='airportName' />
						</th>
						<th align="center">
							<s:text name='airport.country' />
						</th>
						<th align="center">
							<s:text name='airportTax' />
						</th>
						<th>
							<s:text name="modify" />
						</th>
						<th>
							<s:text name="delete" />
						</th>
					</tr>
				</thead>
				<tbody>
					<s:form action="deleteAirports" namespace="/mainService"
						id="deleteAirportsForm">
						<s:iterator value="airportList" status="airport">
							<tr>
								<td>
									<s:checkbox name="id" value="false" fieldValue="%{id}"></s:checkbox>
								</td>
								<td align="left">
									<s:property value="name" />
								</td>
								<td align="left">
									<s:property value="country" />
								</td>
								<td align="right">
									<s:property value="airportTax" />
								</td>
								<td>
									<a href="./queryAirport.action?id=<s:property value='id'/>"><s:text
											name="modify" /> </a>
								</td>
								<td>
									<a href="./deleteAirport.action?id=<s:property value='id'/>"><s:text
											name="delete" /> </a>
								</td>
							</tr>
						</s:iterator>
					</s:form>
				</tbody>
			</table>
			</s:if>
			<s:else>
				<s:text name="noAirport"></s:text>
			</s:else>
		</s:if>
		<script>
	function selectAll(father,child) {
		var o = document.getElementsByName(child);
		var flag = document.getElementById(father).checked;
		for (i = 0; i < o.length; i++) {
			o[i].checked = flag;
		}
	}
</script>
	</body>
</html>
